.cm-tabs {
    display: flex;
    flex-direction: column;
}

.cm-tabs-bottom {
    display: flex;
    flex-direction: column-reverse;

    .cm-tabs-header-wrap {
        border-bottom: none;
        border-top: 1px solid var(--cui-default-border);
    }

    .cm-tabs-active-line {
        bottom: auto;
        top: -1px;
    }
}

.cm-tabs-header-wrap {
    border-bottom: 1px solid var(--cui-default-border);
    display: flex;
}

.cm-tabs-content-wrap {
    flex: auto;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.cm-tabs-header {
    list-style: none;
    margin: 0;
    padding: 0;
    white-space: nowrap;
    display: flex;
    gap: 8px 24px;
    transition: transform 0.3s ease-in-out;
}

.cm-tabs-header-item-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.cm-tabs-more {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 0 9px;
    background-color: var(--cui-color-bg-1);
    position: relative;
    z-index: 1;
    box-shadow: -5px 0 5px 0px rgba(0, 0, 0, 0.08);
}

.cm-tabs-more-dropdown .cm-dropdown-item {
    justify-content: space-between;
}

.cm-tabs-next,
.cm-tabs-prev {
    width: 20px;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    display: none;
    transition: all 0.15s linear;
    height: 31px;
    font-weight: 600;
    color: var(--cui-color-primary);

    &:hover {
        background-color: rgba(100, 100, 100, 0.1);
    }
}

.cm-tabs-prev {
    border-radius: var(--cui-border-radius-small) 0 0 0;
}

.cm-tabs-next {
    border-radius: 0 var(--cui-border-radius-small) 0 0;
}

.cm-tabs-prev-disabled,
.cm-tabs-next-disabled {
    color: var(--cui-color-disabled-text)
}

.cm-tabs-overflow {

    .cm-tabs-next,
    .cm-tabs-prev {
        display: flex;
    }
}

.cm-tabs-header-item {
    list-style: none;
    cursor: pointer;
    position: relative;
    transition: all .3s ease-in-out;
    display: inline-flex;
    align-items: center;
    color: var(--cui-color-text-2);

    &>div {
        padding: 8px 0;
        display: inline-flex;
        align-items: center;
    }

    &:hover {
        color: var(--cui-color-text-1);
    }

    .cui-icon:not(.cm-tabs-close) {
        margin-right: 5px;
    }
}

.cm-tabs-header-item.cm-tabs-header-item-active {
    color: var(--cui-primary-color);
}

.cm-tabs-scroll {
    height: 100%;
    overflow: hidden;
    flex: 1;
    display: flex;
    position: relative;
}

.cm-tabs-card {
    .cm-tabs-active-line {
        display: none;
    }

    .cm-tabs-header {
        display: inline-flex;
        gap: 5px;
    }

    .cm-tabs-header-item {
        background-color: var(--cui-color-bg-2);
        height: 32px;

        &>div {
            padding: 5px 16px !important;
        }

        &::after {
            content: '';
            position: absolute;
            inset: 0;
            pointer-events: none;
            border: 1px solid var(--cui-default-border);
            border-radius: var(--cui-border-radius-small);
        }
    }

    .cm-tabs-header-item-active {
        &.cm-tabs-header-item {
            background-color: var(--cui-color-bg-1);
        }
    }

    &.cm-tabs-top {
        .cm-tabs-scroll {
            margin-bottom: -1px;
        }

        .cm-tabs-header-item {
            &::after {
                border-bottom-left-radius: 0;
                border-bottom-right-radius: 0;
            }

            &.cm-tabs-header-item-active {
                &::after {
                    border-bottom: none;
                }
            }
        }
    }

    &.cm-tabs-bottom {
        .cm-tabs-scroll {
            margin-top: -1px;
        }

        .cm-tabs-header-item {
            &::after {
                border-top-left-radius: 0;
                border-top-right-radius: 0;
            }

            &.cm-tabs-header-item-active {
                &::after {
                    border-top: none;
                }
            }
        }
    }

    &.cm-tabs-left {
        .cm-tabs-scroll {
            margin-right: -1px;
        }

        .cm-tabs-header-item {
            &::after {
                border-top-right-radius: 0;
                border-bottom-right-radius: 0;
            }

            &.cm-tabs-header-item-active {
                &::after {
                    border-right: none;
                }
            }
        }
    }

    &.cm-tabs-right {
        .cm-tabs-scroll {
            margin-left: -0.5px;
        }

        .cm-tabs-header-item {
            &::after {
                border-top-left-radius: 0;
                border-bottom-left-radius: 0;
            }

            &.cm-tabs-header-item-active {
                &::after {
                    border-left: none;
                }
            }
        }
    }
}

.cm-tabs-button {
    .cm-tabs-active-line {
        display: none;
    }

    .cm-tabs-header-wrap {
        border: none;
    }

    .cm-tabs-header {
        display: inline-flex;
        gap: 5px;
    }

    .cm-tabs-header-item {
        border-radius: var(--cui-border-radius-small);
        align-items: center;
        justify-content: center;

        &>div {
            padding: 5px 16px;
        }

        &.cm-tabs-header-item-solid {
            background-color: var(--cui-color-fill-0);

            &.cm-tabs-header-item-active {
                color: #fff;
                background-color: var(--cui-color-primary);
            }
        }

        &.cm-tabs-header-item-light {
            background-color: var(--cui-color-fill-0);

            &.cm-tabs-header-item-active {
                background: var(--cui-color-fill-2);
            }
        }

        &.cm-tabs-header-item-outline {
            border: 1px solid var(--cui-color-border);

            &.cm-tabs-header-item-active {
                border: 1px solid var(--cui-color-primary);
            }
        }

        &.cm-tabs-header-item-active,
        &:hover {
            background: var(--cui-color-fill-1);
        }
    }
}

.cm-tabs-header-item-disabled {
    pointer-events: none;
    color: var(--cui-color-disabled-text);
}

.cm-tabs-content {
    flex: 1;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.cm-tabs-with-animation {
    .cm-tabs-content {
        transition: transform 0.1s ease-in-out;
    }
}

.cm-tab-panel {
    flex-shrink: 0;
    width: 100%;
    transition: opacity .3s;
    opacity: 0;
    outline: 0;
    height: 0;
}

.cm-tabs-keep-height {
    .cm-tab-panel {
        height: auto;
    }
}

.cm-tab-panel-active {
    opacity: 1;
    height: auto;
}

.cm-tabs-active-line {
    position: absolute;
    bottom: -1px;
    height: 2px;
    background: var(--cui-primary-color);
    transition: all 0.3s ease-in-out;
    left: 0;
}

.cm-tabs-close {
    width: 12px;
    margin-left: 8px;
    margin-right: -4px;
    transition: all 0.3s ease-in-out;
    overflow: hidden;

    &:hover {
        color: var(--cui-primary-color);
    }
}

.cm-tabs-left,
.cm-tabs-right {

    .cm-tabs-prev,
    .cm-tabs-next {
        width: 100%;
        height: 24px;
    }

    .cm-tabs-more {
        padding: 9px 0;
        justify-content: center;
        box-shadow: 0 -5px 5px 0px rgba(0, 0, 0, 0.08);
    }

    .cm-tabs-header-item {
        &>div {
            padding: 5px 16px;
        }
    }

    .cm-tabs-scroll {
        flex-direction: column;
    }
}

.cm-tabs-left {
    display: flex;
    flex-direction: row;

    .cm-tabs-header {
        display: inline-flex;
        flex-direction: column;
    }

    .cm-tabs-header-wrap {
        border-bottom: none;
        border-right: 1px solid var(--cui-default-border);
        flex-direction: column;
    }

    .cm-tabs-active-line {
        bottom: auto;
        width: 2px;
        left: auto;
        top: 0;
        right: -1px;
    }
}

.cm-tabs-right {
    display: flex;
    flex-direction: row-reverse;

    &.cm-tabs-button {
        .cm-tabs-header-wrap {
            border: none;
        }
    }

    .cm-tabs-header {
        display: inline-flex;
        flex-direction: column;
    }

    .cm-tabs-header-wrap {
        border-bottom: none;
        border-left: 1px solid var(--cui-default-border);
        flex-direction: column;
    }

    .cm-tabs-active-line {
        bottom: auto;
        width: 2px;
        left: auto;
        top: 0;
        left: -1px;
    }
}

.cm-tabs-line {

    &.cm-tabs-top,
    &.cm-tabs-bottom {

        .cm-tabs-prev,
        .cm-tabs-next {
            height: 38px;
        }
    }

    &.cm-tabs-left,
    &.cm-tabs-right {
        .cm-tabs-header-item {
            justify-content: center;
        }
    }
}

.cm-tabs-button {

    &.cm-tabs-top,
    &.cm-tabs-bottom {

        .cm-tabs-prev,
        .cm-tabs-next {
            height: 32px;
        }
    }
}

.cm-tabs-extra-append,
.cm-tabs-extra-prepend {
    display: inline-flex;
    align-items: center;
}

.cm-tabs-centered {
    .cm-tabs-scroll {
        justify-content: center;
    }
}

.cm-tabs-bordered {
    background: var(--cui-color-bg-1);
    border-radius: var(--cui-border-radius-medium);
    border: 1px solid var(--cui-default-border);

    .cm-tabs-header-wrap {
        padding: 4px 16px 0 16px;
    }

    .cm-tab-panel {
        padding: 16px;
    }
}